import 'dart:async';

import 'package:dio/dio.dart';
import 'package:logger/logger.dart';
import 'package:talker_dio_logger/talker_dio_logger_interceptor.dart';
import 'package:talker_dio_logger/talker_dio_logger_settings.dart';
import 'package:ui_demo/market/stock_api.dart';

import 'constant.dart';

final logger = Logger();

void main(List<String> args) {
  final dio = Dio(); // Provide a dio instance
  dio.options.headers['Demo-Header'] =
  'demo header'; // config your dio headers globally
  // dio.interceptors.add(CookieStore)
  // dio.interceptors.add(TalkerDioLogger(
  //   settings: const TalkerDioLoggerSettings(
  //     printRequestHeaders: true,
  //     printResponseHeaders: true,
  //     printResponseMessage: true,
  //   ),
  // ),
  // );

  final client = RestClient(dio);


  // client.getStockList().then((it) => it.forEach((element) {
  //   logger.i(element.toString());
  // }));

  // client.getStockList().then((it) => logger.i(it.toString()));

  for (var element in list) {
    var ele = element;
    // logger.i(ele);
    client.getStockDetail(element).then((it) {
      // logger.i(it);
      logger.i("$ele:__${it.currentPrice}___${it.pc}");
    });
    // Timer timer = Timer.periodic(const Duration(minutes: 10), (timer) {
    //
    // }
    // });
  }
}